Skip to content

New. ContactEncoder. Add option to exclude selected contact data. - #887

Open
svedge wants to merge 6 commits into
devfrom
upd-ce-6
Open

New. ContactEncoder. Add option to exclude selected contact data.#887
svedge wants to merge 6 commits into
devfrom
upd-ce-6

Conversation

@svedge

@svedge svedge commented Sep 10, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 30.67%. Comparing base (bd22469) to head (11cebac).
⚠️ Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
...ntalk/ApbctWP/PluginSettingsPage/SettingsField.php 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev     #887      +/-   ##
============================================
+ Coverage     30.47%   30.67%   +0.20%     
- Complexity     6627     6638      +11     
============================================
  Files           292      292              
  Lines         26432    26487      +55     
============================================
+ Hits           8056     8126      +70     
+ Misses        18376    18361      -15     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new excluded-strings setting can bypass the documented “20 values / 128 chars” limits when users mix commas and newlines, because validation and runtime parsing split the input differently.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adds a “do not encode these contacts” option to the ContactsEncoder feature, allowing administrators to exclude specific emails/phones (and fragments like domains) from being obfuscated during content processing.

Changes:

  • Introduces an exclusion list setting (data__email_decoder_excluded_strings) and wires it into ContactsEncoder params.
  • Adds exclusion parsing + matching logic (including phone digit normalization and mailto:/tel: normalization).
  • Updates settings UI (field + help text) and adds unit tests covering exclusion behavior.
File summaries
File Description
tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php Adds tests ensuring excluded strings keep emails/phones unencoded in typical “title-like” content.
tests/ApbctWP/ContactsEncoder/Exclusions/TestExclusionsService.php Adds tests for parsing excluded strings and matching email/phone variants.
lib/Cleantalk/Common/Helper.php Updates dnsResolve() PHPDoc return/param types.
lib/Cleantalk/Common/ContactsEncoder/Exclusions/ExclusionsService.php Adds excluded-strings parsing and contact exclusion matching logic.
lib/Cleantalk/Common/ContactsEncoder/Dto/Params.php Adds excluded_strings param to pass exclusion list into the encoder.
lib/Cleantalk/Common/ContactsEncoder/ContactsEncoder.php Skips encoding for matches that are deemed excluded by ExclusionsService.
lib/Cleantalk/ApbctWP/State.php Adds default WP setting for the new excluded-strings textarea.
lib/Cleantalk/ApbctWP/PluginSettingsPage/SettingsField.php Adjusts textarea title rendering to add a modifier class when help is present.
lib/Cleantalk/ApbctWP/ContactsEncoder/ContactsEncoder.php Adds description/long-description strings for the new setting UI.
inc/cleantalk-settings.php Registers the new setting, validates/sanitizes it, and adds long-description metadata.
css/src/cleantalk-admin-settings-page.css Adds styling for the textarea title when help icon is present.
css/cleantalk-admin-settings-page.min.css Minified CSS update reflecting the new modifier class styling.
cleantalk.php Passes parsed excluded strings into ContactsEncoder params during instantiation.
Review details

Files not reviewed (1)

  • css/cleantalk-admin-settings-page.min.css: Generated file
  • Files reviewed: 12/13 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread inc/cleantalk-settings.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is cohesive, covered by new tests, and integrates the new setting end-to-end with no confirmed functional regressions.

Review details

Files not reviewed (1)

  • css/cleantalk-admin-settings-page.min.css: Generated file
  • Files reviewed: 13/14 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread cleantalk.php

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The feature is implemented end-to-end (settings, sanitization, runtime behavior) with targeted tests, and only minor documentation clarity feedback remains.

Review details

Files not reviewed (1)

  • css/cleantalk-admin-settings-page.min.css: Generated file
  • Files reviewed: 13/14 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread lib/Cleantalk/Common/Helper.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new code introduces a UTF-8 truncation risk in excluded-string sanitization, and the touched dnsResolve() implementation appears incompatible with common hostname inputs (breaking its primary call site).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Files not reviewed (1)

  • css/cleantalk-admin-settings-page.min.css: Generated file
  • Files reviewed: 13/14 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread inc/cleantalk-settings.php
Comment thread lib/Cleantalk/Common/Helper.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Exclusion matching currently applies digit-based phone comparisons to email matches too, which can incorrectly skip encoding for emails containing long digit sequences.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Files not reviewed (1)

  • css/cleantalk-admin-settings-page.min.css: Generated file
  • Files reviewed: 13/14 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread lib/Cleantalk/Common/ContactsEncoder/Exclusions/ExclusionsService.php Outdated
Comment thread lib/Cleantalk/Common/Helper.php Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants